<%@ page import="org.apache.ibatis.session.SqlSession" %>
<%@ page import="myschool.mybatisUtil.MybatisUtil" %>
<%@ page import="myschool.dao.GradeDao" %>
<%@ page import="myschool.entity.Grade" %>
<%@ page import="java.util.List" %><%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2023/6/5
  Time: 17:51
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<%
    SqlSession s= MybatisUtil.get();
    GradeDao mapper = s.getMapper(GradeDao.class);
    List<Grade> grades = mapper.findAll();
    MybatisUtil.close(s);
%>
<form action="doAddSubject.jsp" method="post">
    <div>
        <label>科目名:</label>
        <input type="text" name="subName" >
    </div>
    <div>
        <label>课时:</label>
        <input type="number" name="classHour" >
    </div>
    <div>
        <select name="gradeID">
            <%
            for (Grade grade : grades) {
                %>
            <option value="<%=grade.getId()%>"><%=grade.getGname()%></option>
            <%
            }
            %>
        </select>
    </div>
    <div>
        <input type="submit" value="添加">
    </div>
</form>
</body>
</html>
